<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
<title>个人中心</title>
<link rel="stylesheet" type="text/css" href="../css/aui.css">
<link rel="stylesheet" type="text/css" href="../css/aui-slide.css">
<link rel="stylesheet" type="text/css" href="../css/aui-flex.css">
<link rel="stylesheet" type="text/css" href="../css/my.css">
<link rel="stylesheet" type="text/css" href="../css/index.css">
<link rel="stylesheet" type="text/css" href="../css/common.css">
<style type="text/css">
	img.vip-icon{height: .5rem;display: inline-block;vertical-align: baseline;margin-right: .2rem;}
	.tool,.order{color: #757575;margin: 0.6rem 0.5rem;}
	.tool img{width: 2rem;height: 2rem;}
  .agency{
    display: flex;
    justify-content:space-between;
  }
	.aui-text-danger{color:#FE417A !important;}
	.aui-grid-label p{color:#666;}
	.my_sj {position: absolute;right;height: 1.25rem;right: -0.75rem;background:rgba(0,0,0,0.1);border-top-left-radius: 1.25rem;border-bottom-left-radius: 1.25rem;z-index: 99;color: white;font-size: 0.6rem;  padding: 0 0.55rem;line-height: 1.25rem;top:0.7rem;}
	.my_sj img{float: left;width:0.8rem;margin: 0.25rem 0.3rem 0 0;}
	#copy {margin-left: 0.4rem;padding-top: 0.2rem;height: 1rem;display: inline-block;}
	#copy img{float: left;;width: 0.7rem;margin-top: 0.24rem;}
	.vip{background-image: url(../image/newImg/jf.png)}
	.aui-img1{width:1.2rem;height:auto;}
	.order  .aui-card-list-header{border-bottom: 1px solid #ddd;}
	.aui-row{margin-top: 0.5rem;}
	.ad {padding: 0.75rem 0;height:5rem;position: relative;margin: 0.1rem 0.4rem;}
	.ad dt{position: absolute;}
	.ad dd{padding-left:5.5rem;}
	.ad dd h5{font-size: 0.8rem;color:#666;font-weight: 500;padding: 0.6rem 0 0.4rem}
	.ad dd p{color:#999999;font-size: 0.6rem;}
	.ad img{width:5rem;}
	.ad i{position: absolute;right: 0.4rem;color:#999999;font-size: 1rem;top:2rem}
</style>
</head>
<body>
<div class="aui-mask aui-mask-in" style="background: none;" tapmode></div>
<div class="bg_img" style=" background:left top url(../image/newImg/my_bg@3x.png) no-repeat;background-size:100% 100%;padding-top:10px">
<!-- 顶部 -->
<header class="aui-bar aui-bar-nav index_top" id="header">
 <!--<a class="aui-pull-left aui-btn" onclick="duiba('sign')"> <span class="aui-iconfont aui-qiandao">每日签到</span> </a>-->
 <a class="aui-pull-right aui-btn"  onclick="openPublic(this)" data-frame="setting_frm" data-title="设置" tapmode=""> <span class="aui-iconfont"><img src="../image/newImg/set.png" class="aui-margin-r-10" style="width:1rem; height:1rem" /></span></a>
</header>
<!-- 顶部end -->
<!-- banner -->

<section class="aui-content-padded" style="margin:0.75rem 0;">
  <div class="aui-card-list kapian" style="background:transparent">
    <div class="aui-card-list-header aui-card-list-user">
      <div class="aui-card-list-user-avatar" style="width:2.5rem;"> <img src="../image/icon.png" id="headimg" class="aui-img-round" /> </div>
      <div class="aui-card-list-user-name">
				<!--<div class="my_sj" onclick="openPublic(this)" data-frame="task_frm" data-title="赚取积分"><img src="../image/newImg/wysj@3x.png" alt="">赚取积分</div>-->
				<div class="name_box" style="width:100%;height:1.5rem;">
        	<div id="nickname" style="color:white;float:left;font-size:1rem">登录/注册</div>
					<div class="icon_name" style="margin-left:0.5rem;float:left;font-size:0.6rem;background:#FEC147;color:white;padding:0 0.3rem;border-radius:1rem;margin-top:0.3rem;"><span id="leval">惠好物</span></div>
				</div>
        <!-- <small class="dedao"><img src="../image/vip.png" class="vip-icon"><span id="leval">多多客</span></small> -->
      </div>
      <div class="aui-card-list-user-info" onclick="copyd()" style="color:#FFA4C2">邀请码：<span id="invite_code">---</span><span id="copy"><img src="../image/newImg/fz2.svg" alt=""></span></div>
    </div>
    <div class="aui-grid" style="margin-top:1.4rem;background:white !important;">
      <div class="aui-row">
        <div class="aui-col-xs-4" onclick="openPublic(this)" data-frame="shouru_frm" data-title="收入报表" tapmode>
          <div class="aui-list-item-title aui-text-danger">￥<span id="month_yg">0</span></div>
          <div class="aui-grid-label"><p>本月预估</p></div>
        </div>
        <div class="aui-col-xs-4" onclick="openPublic(this)" data-frame="shouru_frm" data-title="收入报表" tapmode>
          <div class="aui-list-item-title aui-text-danger">￥<span id="month_js">0</span></div>
          <div class="aui-grid-label"><p>本月结算</p></div>
        </div>
        <div class="aui-col-xs-4" onclick="openPublic(this)" data-frame="wallet_frm" data-title="我的钱包" tapmode>
          <div class="aui-list-item-title aui-text-danger">￥<span id="money">0</span></div>
          <div class="aui-grid-label"><p>余额</p></div>
        </div>
        <!--<div class="aui-col-xs-3"  onclick="openPublic(this)" data-frame="money_logs_frm" data-title="明细" data-other="3" tapmode>
          <div class="aui-list-item-title aui-text-danger"><span id="score">0</span></div>
          <div class="aui-grid-label"><p>积分</p></div>
        </div>-->
      </div>
    </div>
  </div>
</section>
</div>
<!-- banner end -->
<!--<section class="aui-content-padded vip hide" onclick="duiba('mall')" data-frame="ccus_frm" data-title="" tapmode style="margin:0;margin-top:-0.2rem">
  <div class="aui-media-list-item-inner aui-list aui-media-list aui-padded-t-10" style=" background:none !important;">
    <div class="aui-list-item-media" style="width:1.8rem; margin-left:1rem; padding-right:0.3rem !important;"> <img src="../image/vip.png"> </div>
    <a  href="javascript:;" class="aui-list-item-inner" style="padding:0.5rem 1rem;">
      <div class="aui-list-item-text">
        <div class="aui-list-item-title aui-font-size-16 text-white" style="color:#362221 !important;font-size:0.8rem;font-weight:bold;">
					<img src="../image/newImg/vip.png" style="float:left;height:1rem;margin-right:0.3rem;"><span id="dr_title">特权</span></div>
      </div>
      <div class="aui-list-item-text text-white" id="dr_con" style="color:#666666 !important;"> </div>
			<div class="aui-list-item-right text-white" style="background:#FE417A;display:inline-block;width:3.5rem;text-align:center;border-radius:0.3rem;font-size:0.6rem;padding:0.2rem 0;">立即查看</div>
    </a>
  </div>
</section>-->
<!-- 订单 -->
<section class="aui-content-padded aui-card-list order kapian">
	<div class="aui-grid">
    <div class="aui-card-list-header"> 我的订单 <span class="aui-font-size-12" style="color: #999;" onclick="openPublic(this)" data-frame="order_frm" data-title="我的订单" data-other="1" tapmode>查看全部</span></div>
    <div class="aui-row">
      <div class="aui-col-xs-3" onclick="openPublic(this)" data-frame="order_frm" data-title="我的订单" data-other="1" tapmode>
      	<i class="aui-iconfont"><img src="../image/newImg/qbdd.png" class="aui-img1" /></i>
        <div class="aui-grid-label">全部订单</div>
      </div>
      <div class="aui-col-xs-3" onclick="openPublic(this)" data-frame="order_frm" data-title="我的订单" data-other="3" tapmode>
      	<i class="aui-iconfont"><img src="../image/newImg/yjs.png" class="aui-img1" /></i>
        <div class="aui-grid-label">已结算</div>
      </div>
			<div class="aui-col-xs-3" onclick="openPublic(this)" data-frame="order_frm" data-title="我的订单" data-other="2" tapmode>
        <i class="aui-iconfont"><img src="../image/newImg/yfk.png" class="aui-img1" /></i>
        <div class="aui-grid-label">已付款</div>
      </div>
      <div class="aui-col-xs-3" onclick="openPublic(this)" data-frame="order_frm" data-title="我的订单" data-other="4" tapmode>
      	<i class="aui-iconfont"><img src="../image/newImg/ysx.png" class="aui-img1" /></i>
        <div class="aui-grid-label">已失效</div>
      </div>
    </div>
  </div>
</section>
<!-- 广告 -->
<section class="aui-content-padded aui-card-list ad order kapian" onclick="openPublic(this)" data-frame="ccus_frm" tapmode>
		<dl>
			<i class="aui-iconfont aui-icon-right"></i>
			<dt><img src="../image/newImg/my_ad.png" alt=""></dt>
			<dd><h5>升级权益·让你轻松赚钱</h5><p>自购省钱、邀请好友赚钱</p></dd>
		</dl>
</section>
<!-- 代理中心 -->
<section class="aui-content-padded aui-card-list order kapian">
	<div class="aui-grid">
    <div class="aui-card-list-header agency">
      <span>代理商中心</span>
      <span class="aui-font-size-12" style="color: #999;" onclick="openPublic(this)" data-frame="agent_center_frm" data-title="代理中心" tapmode>查看全部</span>
    </div>
    <div class="aui-row">
      <div class="aui-col-xs-3" onclick="openPublic(this)" data-frame="shouru_frm" data-title="收入报表" tapmode>
      	<i class="aui-iconfont"><img src="../image/newImg/sybb.png" class="aui-img1" /></i>
        <div class="aui-grid-label">收益报表</div>
      </div>
      <div class="aui-col-xs-3" onclick="openPublic(this)" data-frame="order_frm" data-title="粉丝订单" data-other="9" tapmode>
        <i class="aui-iconfont"><img src="../image/newImg/fsdd.png" class="aui-img1" /></i>
        <div class="aui-grid-label">粉丝订单</div>
      </div>
      <div class="aui-col-xs-3" onclick="openPublic(this)" data-other="0" data-frame="team_frm" data-title="我的团队" tapmode >
      	<i class="aui-iconfont"><img src="../image/newImg/tdfs.png" class="aui-img1" /></i>
        <div class="aui-grid-label">团队粉丝</div>
      </div>
      <div class="aui-col-xs-3" onclick="openPublic(this)" data-frame="wallet_frm" data-title="我的钱包" tapmode>
      	<i class="aui-iconfont"><img src="../image/newImg/qb.png" class="aui-img1" /></i>
        <div class="aui-grid-label">钱包</div>
      </div>

    </div>
  </div>
</section>

<!-- 快捷入口 -->

<section class="aui-content-padded aui-card-list tool kapian">
  <div class="aui-grid">
    <div class="aui-card-list-header"> 必备工具 </div>
    <div class="aui-row">
      <div class="aui-col-xs-3" onclick="TbLogin()" tapmode>
      	<i class="aui-iconfont"><img src="../image/newImg/tbsq.png" class="aui-img1" /></i>
        <div class="aui-grid-label">淘宝授权</div>
      </div>
      <div class="aui-col-xs-3" onclick="openPublic(this)" data-other="0" data-frame="collect_frm" data-title="我的足迹" tapmode >
      	<i class="aui-iconfont"><img src="../image/newImg/wdzj.png" class="aui-img1" /></i>
        <div class="aui-grid-label">我的足迹</div>
      </div>
      <div class="aui-col-xs-3" onclick="openPublic(this)" data-other="1" data-frame="collect_frm" data-title="我的收藏" tapmode >
      	<i class="aui-iconfont"><img src="../image/newImg/wdsc.png" class="aui-img1" /></i>
        <div class="aui-grid-label">我的收藏</div>
      </div>
      <div class="aui-col-xs-3" onclick="openPublic(this)" data-other="0" data-frame="team_frm" data-title="我的团队" tapmode >
      	<i class="aui-iconfont"><img src="../image/newImg/wdtd.png" class="aui-img1" /></i>
        <div class="aui-grid-label">我的团队</div>
      </div>
      <div class="aui-col-xs-3" onclick="openPublic(this)" data-frame="share_friend_frm" data-title="邀请分享" tapmode >
      	<i class="aui-iconfont"><img src="../image/newImg/yqfx.png" class="aui-img1" /></i>
        <div class="aui-grid-label">邀请分享</div>
      </div>
      <div class="aui-col-xs-3" onclick="zhichi()">
      	<i class="aui-iconfont"><img src="../image/newImg/lxkf.png" class="aui-img1" /></i>
        <div class="aui-grid-label">联系客服</div>
      </div>
      <div class="aui-col-xs-3" onclick="openWeb(this)" data-url="" data-title="新手教程" id="xsjc" tapmode >
      	<i class="aui-iconfont"><img src="../image/newImg/xsjc.png" class="aui-img1" /></i>
        <div class="aui-grid-label">新手教程</div>
      </div>
      <div class="aui-col-xs-3" onclick="openWeb(this)" data-url="" data-title="帮助中心" id="help"  tapmode >
      	<i class="aui-iconfont"><img src="../image/newImg/bzzx.png" class="aui-img1" /></i>
        <div class="aui-grid-label">帮助中心</div>
      </div>
    </div>
  </div>
</section>
<!-- 快捷入口 end -->

</body>

<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/zepto.min.js" ></script>
<script type="text/javascript" src="../script/common.js" ></script>
<script type="text/javascript">
    apiready = function(){
        api.parseTapmode();
        var header = $api.byId('header');
        headerH = $api.fixStatusBar(header);
        //是否登录
      	if (!is_login()) {
    		    $('.aui-mask').click(function(){
                openWin('login');
                return false;
            });
            openWin('login');
            //停止下拉刷新
            api.refreshHeaderLoadDone();
      	}else{
            $('.aui-mask').remove();
            AjaxData();
        }
        //下拉刷新
        _Refresh(function(){
            AjaxData();
        });
        //监听用户登录
        _AddEventListener('UserLogin', function(ret) {
            $('.aui-mask').remove();
            //刷新
             AjaxData();
        });
        _AddEventListener('bind_mobile_wechat', function(ret) {
            //刷新
             AjaxData();
        });
        //监听用户退出登录
        _AddEventListener('UserLogout', function(ret) {
             if (ret)
             {//.重载页面
                 _RefreshPage();
             }
        });
    }
    function AjaxData(){
      _loading2();
    	_Ajax(window.APIServer.UserInfo,'post',{values:{}},'json',function(ret){
        _loading2_close();
        //.渲染页面
        if (ret.code==1) {
            $('.aui-mask').remove();
            var uinfo = ret.data;
            _SetPrefs('uinfo', uinfo);
            $('#nickname').html(uinfo.nickname);
            if (uinfo.headimgurl!='') {
                $('#headimg').attr('src',uinfo.headimgurl);
            }
            $('#leval').html(uinfo.leval_text);
            $('#invite_code').html(uinfo.invite_code);
            $('#money').html(uinfo.money);
            $('#score').html(uinfo.score);
            $('#month_yg').html(uinfo.month_yg);
            $('#month_js').html(uinfo.month_js);
            $('#kf').attr('data-url',uinfo.app_kf_url);
            $('#xsjc').attr('data-url',uinfo.app_xsjc_url);
            $('#help').attr('data-url',uinfo.app_help_url);
            var ad = uinfo.app_center_ad;
            if (ad.title!=='') {
              $('.vip').show();
              $('#dr_title').html(ad.title);
              $('#dr_con').html(ad.con);
              //$('.vip').attr('data-url',ad.url);
              $('.vip').attr('data-title',ad.title);
            }

						// 登录成功后 设置别名 API 阿春儿 1223
						var ajpush = api.require('ajpush');
						var param = {alias:uinfo.uid};
						ajpush.bindAliasAndTags(param,function(ret) {
								 var statusCode = ret.statusCode;
								//  alert('处理结果：\n' + JSON.stringify(ret));
						});

					//  alert('绑定结果\n' + JSON.stringify(param));

        }else if(ret.code === 501 || 502){//.Token过期
				//logout();
  			}else{
          _toast(ret.msg)
        }

      })
    }
    //淘宝授权登录
    function TbLogin(){
        var aliBC = api.require('aliBC');
        aliBC.showLogin(function(ret,err){
            if(ret.status){
                _Ajax(window.APIServer.BindTb,'post',{values:ret},'json',function(ret){
                    if (ret.code==1) {
                        _toast('已授权');
                    }else{
                        _toast(ret.msg)
                        aliBC.logout(function(ret,err){});//清除授权
                    }
                })
            }else{
                _toast('授权失败');
            }
        });
    }
    function TbLogout(){
      var aliBC = api.require('aliBC');
      aliBC.logout(function(ret,err){
          if(ret.status){
              _toast('已退出');
              //alert(JSON.stringify(ret));
          }else{
              //alert(JSON.stringify(err));
          }
      });
    }
    function copyd(){
      //广播事件：站内复制
      _SendEvent('app_copy');
      copy($('#invite_code').text())
    }

</script>
</html>
